package com.mind.db;

import com.bugull.mongo.cache.DaoCache;
import com.mind.db.DAOConstants.DBKind;
import com.mind.db.DAOConstants.DBType;

/**
 *2012-3-29@author yangshaobo
 * 
 * @param <T>
 */
public class DaoManager {
	private static DaoManager daoManager = new DaoManager();

	public static DaoManager getInstance() {
		return daoManager;
	}

	public IDao getDao(Class clazz) {
		return getDao(DBKind.normal, clazz);
	}
	public IDao getDao(DBKind kind,Class clazz) {
		DBType type = null;
		switch(kind){
		case normal:
			type=DBConfig.getInstance().getDb_type();
			break;
		case log:
			type=DBConfig.getInstance().getLog_db_type();
			break;
		}
		switch (type) {
		case MONGODB:
			return DaoCache.getInstance().get(clazz);
		}
		return null;
	}
}
